import angular from 'angular';
import uirouter from '@uirouter/angularjs';
import oclazyload from 'oclazyload';
import './style/main.css';

var myApp = angular.module('app', [uirouter,oclazyload]);

myApp.config(["$stateProvider","$locationProvider","$urlRouterProvider",function($stateProvider,$locationProvider,$urlRouterProvider){

	$locationProvider.html5Mode(false);
	$urlRouterProvider.otherwise('/home');

	$stateProvider.state('home',{
		url: '/home',
		views: {
			"header": {
				templateUrl: 'assets/views/header/header.html',
				controller: 'headerCtrl',
				controllerAs: 'vm',
			}
		},
		resolve: {
			serviceA: function(){
				return {
					"name": "serviceA",
					"id": "001"
				}
			},
			controller: ["$ocLazyLoad",function($ocLazyLoad){
				return $ocLazyLoad.load("assets/views/header/header.controller.js");
			}]
		}
	}).state("home.notice",{
		url: '/:courseId/notice',
		params: {
			context: ''
		},
		views: {
			"content": {
				templateUrl: 'assets/views/coursenotice/coursenotice.html',
				controller: 'CourseNoticeCtrl as vm',
			},
		},
		resolve: {
			controller: ["$ocLazyLoad",function($ocLazyLoad){
				return $ocLazyLoad.load(["assets/views/coursenotice/coursenotice.controller.js"]);
			}]
		}
	}).state("home.outline",{
		url: '/:courseId/outline',
		params: {
			context: ''
		},
		views: {
			"content": {
				templateUrl: 'assets/views/outline/outline.html',
				controller: 'outlineCtrl as vm',
			},
		},
		resolve: {
			controller: ["$ocLazyLoad",function($ocLazyLoad){
				return $ocLazyLoad.load(["assets/views/outline/outline.controller.js"]);
			}]
		}
	})
}]);